

@echo off
for /d %%i in (d:\*) do echo %%i

echo -----------------------------------
for /d %%i in (???) do echo %%i

echo -----------------------------------
for /d %%i in (java) do echo %%i

pause